<style>
    .keyList{position: absolute;z-index: 9999;background-color: #fff; line-height: 32px;}
    .keyList li:hover{background-color: #eee;}
    .keyList li{padding: 5px;cursor: pointer;}
</style>
<div class="layui-form-item [class2]" style="position: relative;">
    <label class="layui-form-label">[title]</label>
    <div class="layui-input-inline">
        <input type="[type]" name="[name]" value="[value]" [readonly] lay-verify="required"
               placeholder="请输入关键词搜索..." autocomplete="off" class="layui-input">
        <input type="hidden" name="[name]ID" value="[valueID]">
        <input type="hidden" name="PathID">
        <div class="[name]KeyList keyList">
        </div>
    </div>
</div>
<script>
    $(function (){
        $("input[name='[name]']").on("input",function (){
            var $key = $(this).val();
            var $pathID = $("input[name='PathID']").val();
            if($key.length == 1){return false;}
            $.post("[url]",{key:$key,pathID:$pathID},function (res){
                if(res.code == 0){
                    var html="";
                    for (var i in res.data){
                        var d = res.data[i]
                        html += "<li data-id='"+d.id+"'>"+d.numbers+" "+d.title+" "+d.sortTitle+"</li>";
                    }
                    $(".[name]KeyList").html(html)
                }
            })
        })
        $(document).on("click",".[name]KeyList li",function (){
            var str = $(this).text()
            var id = $(this).data("id")
            $("input[name='[name]ID']").val(id)
            $("input[name='PathID']").val(id)
            $("input[name='[name]']").val(str)
            $(".[name]KeyList").html('')
        })
    })

</script>